$(function(){
		
	//手机号码
		var username = $("#username");
		//密码  
		var password = $("#password");
		var confirm_password1 = $("#confirm_password1");
		
		
		$(username).on('blur',function(){
			if( !/^1(3|4|5|6|7|8)\d{9}$/.test(username.val())){
				alert("手机号码不正确，请重新输入！");
				flag = 0;
				return flag;
			}
		});
		
		$(password).on('blur',function(){
			if( !/^\S{6,20}$/.test(password.val())){
				alert("密码不正确，请重新输入！");
				return;
			}
		});
		
		$(confirm_password1).on('blur',function(){
			if(password.val() != confirm_password1.val()) {
				alert("两次密码不一致，请重新输入！");
				return;
			}
		});
				
		//cookie
		$('#register').on('click',function(){
			window.location.href="login.html";						
			
			var userName = $("input[name=username]").val();
			var pwd = $("input[name=password]").val();
			$.cookie("userName",userName, { path: "/"});
			$.cookie("pwd",pwd, { path: "/"}); 
					
		});		
	});
	


